package com.zx.idc.backend.gui.api.ftp;

import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * ftp 客户端抽象基类
 * 定义了一些标准的 ftp 连接必须属性
 *
 * @author rxliuli
 */

public abstract class BaseFtpClientConfig {
    /**
     * 默认的根路径
     */
    public static final String DEFAULT_BASE_PATH = "/";
    /**
     * 默认ftp端口:22
     */
    public static final Integer DEFAULT_PORT = 22;
    /**
     * 默认使用sftp
     */
    public static final Integer DEFAULT_TYPE = 2;
    /**
     * ftp 登录账号
     */
    private String username;
    /**
     * ftp 服务器地址
     */
    private String host;
    /**
     * ftp 登录密码
     */
    private String password;
    /**
     * 端口号
     */
    private Integer port;
    /**
     * 基本的路径
     */
    private String basePath;

    /**
     * ftp类型 1:ftp 2:sftp(默认)
     */
    private Integer type;

    public BaseFtpClientConfig() {
        this.type = DEFAULT_TYPE;
        this.port = DEFAULT_PORT;
    }

    public BaseFtpClientConfig(String username, String host, String password, Integer port, String basePath) {
        this.username = username;
        this.host = host;
        this.password = password;
        this.port = port;
        this.basePath = basePath;
    }

    public String getHost() {
        return host;
    }

    public BaseFtpClientConfig setHost(String host) {
        this.host = host;
        return this;
    }

    public Integer getPort() {
        return port;
    }

    public BaseFtpClientConfig setPort(Integer port) {
        this.port = port;
        return this;
    }

    public String getUsername() {
        return username;
    }

    public BaseFtpClientConfig setUsername(String username) {
        this.username = username;
        return this;
    }

    public String getPassword() {
        return password;
    }

    public BaseFtpClientConfig setPassword(String password) {
        this.password = password;
        return this;
    }

    public String getBasePath() {
        return basePath;
    }

    public BaseFtpClientConfig setBasePath(String basePath) {
        this.basePath = basePath;
        return this;
    }

    public Integer getType() {
        return type;
    }

    public BaseFtpClientConfig setType(Integer type) {
        this.type = type;
        return this;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }


}
